import { defineStore } from 'pinia'
import { ref } from 'vue'
import { save, findByStorageKey } from '@/utils/localStorageUtil'

export const useUserStore = defineStore('userStore', () => {
  let accessToken = findByStorageKey('accessToken')
  let refreshToken = findByStorageKey('refreshToken')

  const logout = () => {
    localStorage.removeItem('accessToken')
    localStorage.removeItem('refreshToken')

    accessToken = ''
    refreshToken = ''
  }

  return { accessToken, refreshToken, logout }
})
